Welcome to Brighton in three hours.
OK, here we are practicing saving and loading arrays, lists and dictionaries using numbers.
So first we're going to define an array called my array, which is a random value with the size of two
and six at least, which includes our X1 array, a string and a billion and a dictionary here with three
keys, first key to be X1, second key to be Maehara, and the third key to be the least that we have
defined here.
And then I'm going to print them for you here.
So let's run this and we're going to have these in our workspace.
Then we need to define some fun names.
So for example, for my area, say Farlam Array Furnham loose and find in the dictionary and to save
things using nubby, you have to use extension NPV.
So my full name goes with data and I carry that in.
Why you may have a pass attached to this filename, which is not the case here.
We just want to save it in our current directory.
So I just run this.
So I have all these fun names in my workspace then here, the safe house, so you can simply use the
number that say function.
Then you defined your filename, which are already defined him and in corresponding variable.
So first we save our original list and the dictionary.
So if I understand you save them all.
So if you click here, you're going to see that we have our data underlying array that in privacy and
data online dictionary, that NPV and data underline least that NPV.
So how should we load our different variables that have been saved using that NPV extension in order
to load an array?
You simply say, for example, my data, because the number that load function of an Atlas Pantazis
and the corresponding funding and then here I'm going to print them for you.
So as I see, this is my data, which is an.
How about at least since your list has been saved as a number array, then you have to use this term
pixel.
True.
Which is by default is [REMOVED].
You just defined it and then you have your my data in a form of an array.
But originally it was a list.
So even in order to turn it into a list, you have to use the number and the array to list function
that we have practiced before.
And then you have your list as your my data be printed here.
So let's run cell and here we go.
The type of it is my list.
How about dictionaries?
Similarly, when you load it, you have to have allopurinol equals to true.
But here is a little bit more complicated.
You have to say my data equals to my data that item open and transparent and nothing.
And this way my data becomes a dictionary.
So let's run this.
And as I see the type of my data here is a class dictionary numpty even more so.
There are a lot of materials we haven't talked about, but now you should be able to simply type ENPI
dot and see different functions, class methods that popping up in the list, for example, the reesha
function or repeat function.
And there are many others that you can search and educate yourself, particularly if you go to the official
nanpa website Nampo that Orji.
So let's look into repeat and Rechelle functions on your own.
Okay, now let's just focus on pandas.
We first start with Pandas Loden observe CSFI data in order to load ACSU data, as we have seen before,
a use that read line CSFI and the pass to that particular data and this California underline housing
train data is under sample data, which is a folder that should be the same for everyone as of December
of 2020.
And you have access to this data here and then we just load them.
And here I'm going to print the type of my data.
So if I run this, as I see the type of my data is a class dictionary, let's open the cell so you can
print the data.
And if you run this, you're going to see that we have keys and raw numbers and the corresponding values
within each column, which is corresponding to every key.
So that's how we can actually see and observe this data using the print function.
But you can also use a fancy mode, just type data here.
It shows top five rows and the last five rows of your data in a more fancy way where you have shades
on every two rows and here you have your keys and columns of data.
And here is information about how many rows and columns your data has.
But what if I want to just see the top five rows?
You can use data that head and also data that tell the head can give you the five tables and the tail
gives you the last fibros.
So if I run this, I'm going to see only the top five rows.
If I come in and run, I'm going to see only the bottom fibers.
But how can I turn these values into a numbered format?
So data underlying values equals.
Data that values, if you use that values, its an attribute that gives you only the values of these
zip without any kids.
And if you check the type of the values and the shape of them, you're going to see that the top of
it is known by the array.
And the shape is similar to here, 17000 rows and nine columns.
OK, let's talk about pandas indexing.
We have five examples for you here.
Let's open them.
So in order to get a certain number of rows or columns, you have to use the data that I l.l.c. attribute
and then open and close brackets.
And then you put the indexes corresponding to rows and columns that you want to grab.
For example, I want all the rows of column zero one two, but three so ristorante.
So I only see the first three columns of my data.
This open the second example, let's say if I just want to see all the rows corresponding to column
number one, the front.
So as you see, it's not any more in a fancy format.
This is because when you just put a one here, it sees things like a vector adding that a column vector
or row vector.
So in order to fix that, you can use this trick.
So instead of defining just one here to get one current vector, you can define a range like one to
two.
But what happens, it doesn't get it to only one.
But when you write it this format, you kind of tweak it.
And then when you run this, you see your column of data in the fancy format.
We can also use this trick to get column vectors or vectors instead of vectors in non-pay.
Harris.
OK, let's go an example.
Number four.
And here we are practicing negative indexing.
And in this example, we want to just get the last column of data, some using minus one.
But since I want it to be fancy, I use a column here.
So if I want to sell you the last column of data in a fancy way, we can to example five.
In this example, we want to get the very first column.
And in that case, we define zero to what the trend is.
And as you say, this is the first column or column number zero in a fancy way.
We just talk about a few tricks in pandas to handle our data.
But there are a lot more into pandas that you guys can always go to pandas that predated Orji and educate
yourself about pandas.
Also, you can just simply type with a dart and a list of different functions.
Attributes and classes on methods are popping up here to investigate by yourself.
For example, if you have a panda variable open and close brackets, go back to those quotations here.
You can see all of your keys in that data and then you can pick any one that you want.
And then Rudisill and you get the corresponding column to that particular key value.
If you just want the values here, you put a value here and you get the number array corresponding to
that particular key.
In this lecture, you learn about how to import now PI and pandas in Python, how to implement nanpa
and pandas to some extent, and how to load and save data in Python using numpty.
In the next lecture, we will learn about multiple Ollaberry and Seabourne for data visualizations.
Thank you for your attention.
See you all in the next lecture.